package net.rlair.sbdemo.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * Created by zyy on 2019/3/17.
 */

@Component
@Aspect
@Order(2)
public class Zhaoyuyang2 {
    @Pointcut(value = "execution(public *  net.rlair.sbdemo.controller.ZhaozichenController.list(..)))")
    public void sbAopDemo() {
    }

    @Around(value = "sbAopDemo()")
    public Object around(ProceedingJoinPoint pjp) throws Throwable{
        System.out.println("[Zhaoyuyang2] around advise before");
        Object result = pjp.proceed();
        System.out.println("[Zhaoyuyang2] around advise after");
        return result;
    }

    @AfterReturning(value = "sbAopDemo()")
    public void afterReturning(JoinPoint joinPoint) {
        System.out.println("[Zhaoyuyang2] afterReturning advise");
    }

}
